home *** CD-ROM | disk | FTP | other *** search
- /*
- Copyright (c) 1987 by small systems guild
-
- small systems guild
- PO box 2751
- Ann Arbor, MI 48106
- (313) 996-4238
-
- File: ssgSCSI.h
- Model: LightSpeed C 2.13, Aztec C 3.0
- Target: Macintosh Operating System
-
- */
-
- #define MAX_BLOCKS 32
- #define SIZE MAX_BLOCKS * 512
- #define TIME_OUT 3600
- #define maxDrvs 8
- #define P_DOUT 0x00 /* 0x60 data out */
- #define P_DIN 0x01 /* 0x64 data in */
- #define P_CMD 0x02 /* 0x68 command */
- #define P_STAT 0x03 /* 0x6C status */
- #define P_MOUT 0x06 /* 0x70 Message Out */
- #define P_MIN 0x07 /* 0x74 Message In */
-
- /* transfer instruction op codes */
- enum {
- scInc = 1,
- scNoInc,
- scAdd,
- scMove,
- scLoop,
- scNop,
- scStop,
- scComp
- };
-
- /* result codes */
- enum {
- scCommErr = 2,
- scBadParmsErr = 4,
- scPhaseErr,
- scCompareErr
- };
-
- typedef struct SCSIInstr {
- int scOpcode;
- unsigned long scParam1;
- unsigned long scParam2;
- } SCSIInstr;
-
- struct scsicmd {
- char sc_cmd; /* command code */
- char sc_adrH; /* High Byte of address */
- char sc_adrM; /* Middle byte of address */
- char sc_adrL; /* Low byte of address */
- char sc_arg; /* count or interleave value */
- char sc_vendor; /* vendor byte -- seek algorithm */
- };
-
- struct scsisense {
- char ss_code; /* status code */
- char ss_adrH; /* address when valid */
- char ss_adrM;
- char ss_adrL;
- };
-
- struct Volume {
- short drSigWord; /* should be $D2D7 */
- long drCrDate; /* date and time of initialization */
- long drLsBkUp; /* date and time of last backup */
- short drAtrb; /* volume attributes */
- short drNumFls; /* # of files in file directory */
- short drDirSt; /* first logical block of file dir */
- short drBlLen; /* # of logical blocks in file dir */
- short drNmAlBlks; /* # of allocation blocks on volume */
- long drAlBlkSiz; /* size of allocation blocks */
- long drClpSiz; /* # of bytes to allocate */
- short drAlBlSt; /* logical block number of first
- allocation block */
- long drNxtFNum; /* next unused file number */
- short drFreeBks; /* # of unused allocation blocks */
- char drVN; /* length of volume name */
- char drFill[512-37]; /* volume name & start of alloc. map */
- };
-
- /*
- * NCR5380 registers on the MacSCSI host adapter found at
- * location 0x500000
- */
-
- struct NCR5380 {
- char wr_data, filla; /* force scsi bus data */
- char wr_icmd, fillb; /* initiator command */
- char wr_mode, fillc; /* ncr5380 mode */
- char wr_tcmd, filld; /* target command */
- char wr_sele, fille; /* select enable */
- char wr_send, fillf; /* start send operation */
- char wr_trec, fillg; /* start target recieve */
- char wr_irec, fillh; /* start initiator recieve */
- char fill00, rd_data; /* current scsi bus data */
- char fill01, rd_icmd; /* initiator command status */
- char fill02, rd_mode; /* ncr 5380 mode */
- char fill03, rd_tcmd; /* target command status */
- char fill04, rd_bstat; /* current bus status */
- char fill05, rd_stat; /* chip bus and status info */
- char fill06, rd_input; /* input data */
- char fill07, rd_reset; /* reset strobe */
- };
-
- typedef struct NCR5380 NCR5380;OSErr gSC_unitReady(int); /* test unit ready device status */
- OSErr gSC_reqSense(int); /* request sense error and status info */
- OSErr gSC_select(int); /* arbitrates bus and selects SCSI device */
- OSErr gSC_loadUnload(int); /* load/unload and synchronize the device */
- OSErr gSC_inquire(int); /* inquire device ID and attributes */
- OSErr gSC_rdCapacity(int,Byte *buf); /* get device capacity as hi block & size */
- OSErr gSC_read(int,Byte *,Int32,Int16,UInt16); /* read data from the SCSI device */
-
- OSErr gSC_write(int,Byte *,Int32,Int16,UInt16); /* write data to the SCSI device */
-
- OSErr gSC_error(OSErr); /* prints error messages if verbose TRUE */
- OSErr gSC_cmd(Byte *); /* handles 6 byte SCSI commands only */
- OSErr gSC_6cmd(Byte *); /* issue 6 byte SCSI command, no completion */
- OSErr gSC_10cmd(Byte *); /* issue 10 byte SCSI command, no completion*/
- Byte * gSC_TIB(Byte *,long,long); /* create transfer instruction block code */
- OSErr gSC_CMD(Byte,long,long); /* create SCSI command block structure */
-
- extern struct SCSIInstr cmdbuf;
- extern struct SCSIInstr mbuf[3];
- extern Byte dat[SIZE];
- extern Byte tst[10];
- extern Byte hdr[1024];
-
- extern int sect,stat,msg;
- extern Byte *cmp;
- extern long wait,len;
- extern OSErr err;
- extern int verbose;
-